<?php
$this->breadcrumbs = array(
	UserModule::t('Мой аккаунт'),
);
?>
<h1><?php echo UserModule::t('Мой аккаунт'); ?></h1>

<?php $form = $this->beginWidget('GxActiveForm', 
	array(
		'id' => 'users-form',
		'enableAjaxValidation' => false,
		'htmlOptions'=>array(
			'class'=>'form-horizontal',
		),
	)
);
?>

<?php if(Yii::app()->user->hasFlash('user_profile_msg')): ?>
<p class="text-success"><?php echo Yii::app()->user->getFlash('user_profile_msg'); ?></p>
<?php endif; ?>
<?php if(Yii::app()->user->hasFlash('user_profile_username')): ?>
<p class="text-error"><?php echo Yii::app()->user->getFlash('user_profile_username'); ?></p>
<?php endif; ?>
<?php if(1 != Yii::app()->user->approved): ?>
<div class="control-group">
<?php $this->renderPartial('/default/notapproved', array('email' => $model->username));?>	
</div>
<?php endif; ?>
<?php if ($model->usergroup_id == UserModule::USERGROUP_USER && (1 == Yii::app()->user->approved)): ?>
<div class="control-group">
	<p class="note">
		<a href="<?php echo Yii::app()->createUrl('/user/myfirms'); ?>" ><?php echo UserModule::t('Мои фирмы');?></a> 
	</p>
</div>
<?php endif;?>


<div class="control-group"><p class="note"><?php echo Yii::t('app', 'Поля'); ?> <span class="required">*</span> <?php echo Yii::t('app', 'обязательные'); ?>.</p></div>
<div class="control-group">
	<div class="controls">
		<a href="<?php echo Yii::app()->createUrl(Yii::app()->controller->module->profilePasswordUrl); ?>" ><?php echo UserModule::t('Изменить пароль');?></a> 
	</div>
	<br/>

	<?php echo $form->labelEx($model,'username',array('class'=>'control-label')); ?>
	<div class="controls">
		<?php if (1 != $model->approved && 0 == $model->hidden) : ?>
			<?php echo $form->textField($model, 'username', array('maxlength' => 255,'placeholder'=>UserModule::t('Email'))); ?>
			<span class="help-inline"><?php echo $form->error($model,'username'); ?></span>
		<?php else :?>
			<label><?php echo GxHtml::encode($model->username); ?>
		<?php endif;?>
		</label>
	</div>
</div>

<div class="control-group">
	<?php echo $form->labelEx($model,'last_name',array('class'=>'control-label')); ?>
	<div class="controls">
		<?php echo $form->textField($model, 'last_name', array('maxlength' => 255,'placeholder'=>UserModule::t('Фамилия'))); ?>
		<span class="help-inline"><?php echo $form->error($model,'last_name'); ?></span>
	</div>
</div>
<div class="control-group">
	<?php echo $form->labelEx($model,'first_name',array('class'=>'control-label')); ?>
	<div class="controls">
		<?php echo $form->textField($model, 'first_name', array('maxlength' => 255,'placeholder'=>UserModule::t('Имя'))); ?>
		<span class="help-inline"><?php echo $form->error($model,'first_name'); ?></span>
	</div>
</div>
<div class="control-group">
	<?php echo $form->labelEx($model,'middle_name',array('class'=>'control-label')); ?>
	<div class="controls">
		<?php echo $form->textField($model, 'middle_name', array('maxlength' => 255,'placeholder'=>UserModule::t('Отчество'))); ?>
		<span class="help-inline"><?php echo $form->error($model,'middle_name'); ?></span>
	</div>
</div>

<div class="control-group">
	<div class="controls">
		<?php echo GxHtml::submitButton(UserModule::t('Сохранить'), array('class'=>'btn')); ?>
	</div>
</div>

<?php $this->endWidget(); ?>
<!-- form -->